#ifndef ADMIN_H
#define ADMIN_H

#include <QMainWindow>
#include <QString>
#include <QSqlTableModel>
#include "mysqlserver.h"
#include <QTableView>
#include <QComboBox>
#include <QDataWidgetMapper>

namespace Ui {
class admin;
}

class admin : public QMainWindow
{
    Q_OBJECT

public:
    explicit admin(QString name, QString pass, QString SERVER, QString port,QWidget *parent = nullptr);
    QString name;
    QString pass;

    QString SQL;

    mysqlServer mysql;

    ~admin();

private slots:
    void on_kdcInsert_clicked();

    void on_admintoolBox_currentChanged(int index);

    void on_userSelect_clicked();

    void on_memberSelect_clicked();

    void on_maintaninSelect_clicked();

    void on_kdcSelect_clicked();

    void on_adminSetSql_clicked();

    void on_kdcYes_clicked();

    void on_kdcUpdate_clicked();

    void on_kdcDelete_clicked();

    void on_userInsert_clicked();

    void on_userYes_clicked();

    void on_userUpdate_clicked();

    void on_userDelete_clicked();

    void on_memberInsert_clicked();

    void on_memberDelete_clicked();

    void on_memberUpdate_clicked();

    void on_memberYes_clicked();

    void on_maintainInsert_clicked();

    void on_maintainDelete_clicked();

    void on_maintainUpdate_clicked();

    void on_maintainYes_clicked();

private:
    QSqlTableModel *userModel;
    QSqlTableModel *memberModel;
    QSqlTableModel *kdcModel;
    QSqlTableModel *maintainModel;

    QDataWidgetMapper *mapper;  // 数据映射器
    QComboBox *stateCombo;      // 状态下拉框


    Ui::admin *ui;
};

#endif // ADMIN_H
